<template>
  <!--    共库报告-->
  <Table :table-data="tableData" border
         :headerStyle="{backgroundColor:'#fffbed'}"
         :page="false"
         max-height="400px"
         :tableColumn="tableColumn">
  </Table>
</template>

<script>
import {querySharedLibrary} from '@/api/order'
export default {
  props: ['routesQuery'],
  data() {
    return {
      tableData: [],
      tableColumn: [
        {label: this.$t('APP名称'), align: 'center', prop: 'appName'},
        {label: this.$t('手机号码'), align: 'center', prop: 'phoneType'},
        {label: this.$t('身份证号'), align: 'center', prop: 'idCardType'},
        {label: this.$t('银行账号'), align: 'center', prop: 'bankCardType'},
        {label: this.$t('设备ID'), align: 'center', prop: 'deviceIdType'},
        {label: this.$t('居住地址'), align: 'center', prop: 'addressType'},
      ],
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    async getList() {
      const {userId,userStubId} = this.routesQuery
      const res = await querySharedLibrary({
        userId: parseInt(userId),
        userStubId:parseInt(userStubId)
      })
      if (res.code === 1 && res.data) {
        this.tableData = res.data.map(item => {
          item.phoneType = this.formatType(item.phoneType)
          item.idCardType = this.formatType(item.idCardType)
          item.bankCardType = this.formatType(item.bankCardType)
          item.deviceIdType = this.formatType(item.deviceIdType)
          item.addressType = this.formatType(item.addressType)
          return item
        })
      }
    },
    /*
    * 格式化类型
    * */
    formatType(type) {
      const obj = {
        '-1':this.$t('订单关闭'),
        '-9':this.$t('待补充'),
        0: this.$t('待审核'),
        1: this.$t('审核中'),
        2: this.$t('拒绝'),
        5: this.$t('待打款'),
        6: this.$t('待还款'),
        7: this.$t('延期'),
        8: this.$t('逾期'),
        9: this.$t('结清'),
        24: this.$t("打款中"),
        25: this.$t("初审通过"),
        26: this.$t("初审拒绝"),
        27: this.$t("复审通过"),
        28: this.$t("复审拒绝"),
        29: this.$t("财务初审通过"),
        30: this.$t("财务初审拒绝"),
        31: this.$t("财务复审通过"),
        32: this.$t("财务复审拒绝"),
        33: this.$t("打款成功"),
        34: this.$t("打款失败"),
        35: this.$t("还款成功"),
        36: this.$t("待机审"),
        37: this.$t("获取评分中"),
        38: this.$t("用户取消"),
        39: this.$t("订单拒绝"),
        40: this.$t("系统关闭"),
        41: this.$t("机审拒绝"),
        42: this.$t("机审通过"),
        43: this.$t("初审审批通过"),
        44: this.$t("初审审批拒绝"),
        45: this.$t("复审审批通过"),
        46: this.$t("终审通过"),
        47: this.$t("终审拒绝")
      }
      return obj[type]
    },
    handleSizeChange(val) {
      this.page.pageSize = val
      this.getList()
    },
    handleCurrentChange(val) {
      this.page.pageNum = val
      this.getList()
    }
  }
}
</script>

<style scoped>

</style>
